﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Protocal.App.Common;
using 多协议通信平台.Common;
using 多协议通信平台.Views.Dialog;

namespace 多协议通信平台.ViewModels.Component
{
    public partial class ProxySetDialogModel : ObservableObject
    {
        [ObservableProperty]
        private string proxyPath;

        [RelayCommand]
        public void SetProxyAddress(UserControl ucontrol)
        {
            // set proxy path to special httphelper
            HttpHelper.SetProxy(proxyPath);
            var dialog = ucontrol as ProxySetDialog;
            if (dialog != null)
            {
                dialog.Visibility = System.Windows.Visibility.Collapsed;
            }
        }
    }
}
